﻿using Hangjing.Model;
using Hangjing.SQLServerDAL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;

namespace Hangjing.SQLServerDAL
{
    /// <summary>
    /// 订单处理逻辑（pc,微信等客户端提交订单都调用这个类，）
    /// </summary>
    public class OrderManager
    {
        Custorder dal = new Custorder();

        /// <summary>
        /// 订单内容更新，通知配送员
        /// </summary>
        /// <param name="oid"></param>
        public void TellDeliverUpdateInfo(int oid)
        {
            TellDeliverUpdateInfo(dal.GetModel(oid));
        }

        /// <summary>
        /// 订单内容更新，通知配送员
        /// </summary>
        /// <param name="oid"></param>
        public void TellDeliverUpdateInfo(CustorderInfo order)
        {
            if (order.deliverid > 0 && order.sendstate >= 1 && order.sendstate <=2)
            {
                NoticeHelper notice = new NoticeHelper(null);
                notice.sendWord2Devlier(order.deliverid, "请注意，订单" + order.orderid + "信息有变动", order.orderid);
                Hangjing.DBUtility.SQLHelper.excutesql("UPDATE dbo.Custorder SET Sender = '1' WHERE Unid = " + order.Unid);//数据有修改

            }
            
        }
    }
}
